using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;

public class PlayerAirState : PlayerState
{
    // Start is called before the first frame update
    public PlayerAirState(Player _player, PlayerStateMachine _stateMachine, string _animBoolName) : base(_player, _stateMachine, _animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();

        if (player.IsWallDetected())
        {
            stateMachine.ChangeState(player.wallSlide);// 下降时碰墙转为滑墙状态
        }

        if (player.IsGroundDetected())
        {
            stateMachine.ChangeState(player.idleState);// 接触地面转为待机状态
        }

        if (xInput != 0)
        {
            player.SetVelocity(xInput * player.moveSpeed * .8f, rb.velocity.y);// 空中移动，慢一点
        }
    }
}
